<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Web Solutions
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: mslaria $ ($Date: 2007/07/17 06:19:40 $)
// $RCSfile: functions_date.php,v $ : $Revision: 1.2 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================


if (!defined("INSWIFT")) {
	trigger_error("Unable to process $PHP_SELF", E_USER_ERROR);
}

/**
* Parses 02/05/2005 16:27 into UNIX Timestamp
*/
function returnParsedTime($strtime)
{
	global $_SWIFT;

	$matches = array();
	$result = preg_match("/([0-9]{2})\/([0-9]{2})\/([0-9]{4}) ([0-9]{2}):([0-9]{2})/", $strtime, $matches);
	if (count($matches) == 6 && $result)
	{
		if($_SWIFT["settings"]["dt_caltype"]=="us")
		{
		$day = intval($matches[2]);
		$month = intval($matches[1]);
		$year = intval($matches[3]);
		$hour = intval($matches[4]);
		$minutes = intval($matches[5]);
		}else {
		$day = intval($matches[1]);
		$month = intval($matches[2]);
		$year = intval($matches[3]);
		$hour = intval($matches[4]);
		$minutes = intval($matches[5]);
		}
		return mktime($hour, $minutes, 0, $month, $day, $year);
	}

	return false;
}
?>